package com.zr.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.FindPnameDao;
import com.zr.model.Point;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Repository("findpnamedao")
public class FindPnameDaoImpl<T> extends BaseDaOImpl<T> implements FindPnameDao{
	
	@Override
	public JSONArray findPname() {
		JSONArray ja = new JSONArray();
		String hql = "from Point where pclass=:pclass";
		Query query = this.getCurrentSession().createQuery(hql);
		query.setString("pclass", "主线站点");
		List<Point> p = query.list();
		for (Point point : p) {
			JSONObject j = new JSONObject();
			j.put("id", point.getPid());
			j.put("text", point.getPname());
			ja.add(j);
		}
		return ja;
	}

}
